#include<bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  getchar();
  while(T--) {
    set<int> s;
    string buf;
    getline(cin,buf);
    istringstream line(buf);
    int num;
    while(line>>num) {
      s.insert(num);
    }
    for(auto it=s.begin(),ed=s.end();it!=ed;++it) {
      cout << *it << " ";
    }
  }
  return 0;
}
